The PAFilenameList (a subclass of PAStringList) is a convenient way to deal with lists of filenames. It contains methods for generating lists of filenames from given directories. There is also a specific method for searching the standard libraries (/NextLibrary, /LocalLibrary, ~/Libary). Files can be limited to particular extensions and can be returned with or without their full path and extension.
To use this object inside of InterfaceBuilder, simply drag its icon from the palettes window into the suitcases window. Then drag in a browser and set its delegate to be the filenameList. Then enter something like "Fonts" in the libraries textfield or "/NextLibrary/Documentation" in the directories textfield, type in an extension if you like(font, slo, rtf, etc...) and test interface.
Copyright 1992, Jeff Martin (jmartin@next.com) (415) 780-3833.
This method adds the given filename to the list of strings giving the option to strip the path and/or the extension. It simply does the requested strips and calls addString:ifAbsent:noCopy:sorted:at:(PAStringList). Returns the value of that method (self).
addFilenamesFromDirectories looks out in the directories specified for files with the given extensions (NULL for all files) and adds them to the list. 'directory' is a delimited list of directories and 'ext' is a delimited list of extensions. Assumed delimiters are space, tab, newline, return, colon and comma (' ', '\t', '\n', '\r', ':', ',', '\0'). Returns self.
addFilenamesFromStandardLibrariesDirectory goes a step farther and looks in /NextLibary, /LocalLibrary and ~/Libary for the given directories. This is a convenience for the cases where an app searches the standard libraries. Returns self.
This method is just like addDelimitedStrings: but it allows the filnames to be stripped of their paths and/or extensions before being added. Returns self.
sortFilenamesIgnoringPath: is just like sortStrings except that the full paths are stripped from the file before it is compared. This is useful for cases where you want the files to be in alphabetical order regardless of their full path, while preserving the full path. Returns self.
These methods query and set search paths, extensions and flags to preload the string list when unarchived. This allows for an InterfaceBuilder palette to set the StringList to load interesting things when unarchived (ie, "get all of the files of type 'font' from the standard library directory 'Fonts' ").